<template>
<div class="scroll">
    <!-- 搜索只有样式没有功能, position: fixed -->
    <div class="search-input">
        <input placeholder="请输入关键字搜索">
    </div>
    <!-- 实现切换tab更新数据, position: fixed -->
    <div class="search-tab">
        <div class="tabs fs28">
            <div class="tabItem" :class="[status==1?'tab active':'tab']" @click="tabChange(1,$event)">
                tab1
            </div>
            <div class="tabItem" :class="[status==2?'tab active':'tab']" @click="tabChange(2,$event)">
                tab2
            </div>
            <div class="tabItem" :class="[status==3?'tab active':'tab']" @click="tabChange(3,$event)">
                tab3
            </div>
        </div>
        <div class="move-line"></div>
    </div>
    <!-- 展示结果列表，下拉刷新，上拉底部加载更多  height: 100vh; overflow-y: scroll;-->
    <div class="result-list">
        <div class="list-item" v-for="(item, index) in subList" :key="index">
            {{item.name}}
        </div>
    </div>
</div>
</template>
 
<script>
export default{
props: [''],
 
components: {},
 
data(){
    return{
        status: 1,
        subList: [{
            id: 1,
            name: "花木兰1"
        },{
            id: 2,
            name: "花木兰2"
        },{
            id: 3,
            name: "花木兰3"
        },{
            id: 4,
            name: "花木兰4"
        },{
            id: 5,
            name: "花木兰5"
        },{
            id: 6,
            name: "花木兰6"
        },{
            id: 7,
            name: "花木兰7"
        },{
            id: 8,
            name: "花木兰8"
        },{
            id: 4,
            name: "花木兰4"
        },{
            id: 5,
            name: "花木兰5"
        },{
            id: 6,
            name: "花木兰6"
        },{
            id: 7,
            name: "花木兰7"
        },{
            id: 8,
            name: "花木兰8"
        }]
    }
},
 
mounted(){},
 
methods: {
    tabChange(status, e) {
        this.status = status;
        // 要进一步设置底部的蓝色下线
    }
},
 
}
</script>
 
<style lang='less' scoped>
.scroll{
    background: #f5f5f5;
    .search-input{
        background: #f5f5f5;
        padding: 10px auto;
        input{
            width: 90%;
            height: 40px;
            line-height: 40px;
            border: 1px solid #f5f5f5;
            border-radius: 10px;
            padding-left: 10px;
            margin: 10px 0;
        }
    }
    .search-tab{
        width: 100%;
        height: 40px;
        line-height: 40px;
        background: #fff;
        .tabs{
            display: flex;
            .tabItem{
                width: 33%;
                font-size: 20px;

            }
        }
    }
    .result-list{
        .list-item{
            width: 100%;
            height: 50px;
            line-height: 50px;
            background: #fff;
            margin-top: 10px;
        }
    }
}
.active{
    color: blue;
}
</style>
